package com.demo.database.mapper;

import com.demo.database.data.TDemoEmployee;
import com.demo.database.data.TDemoPosition;
import org.apache.ibatis.annotations.*;

import java.util.List;


/**
 * @cuthor luoxiaojiang
 * @createTime 2019年11月07日15:40:36
 * @Verson 1.0.0
 */

public interface TDemoPositionMapper {

    @Results(id = "positionResultMap", value = {
            @Result(property = "positionId", column = "position_id", id = true),
            @Result(property = "positionName", column = "position_name"),
            @Result(property = "positionDescribe", column = "position_describe"),
            @Result(property = "operTime", column = "oper_time")
    })
    @Select("select * from t_demo_position")
    public List<TDemoPosition> positionQuery() throws Exception;

    @ResultMap("positionResultMap")
    @Select("select * from t_demo_position where position_id=#{id}")
    public TDemoPosition positionQueryID(Integer id) throws Exception;

    @ResultMap("positionResultMap")
    @SelectProvider(type =PositionProvider.class , method = "getQueryAllSql")
    public List<TDemoPosition> positionQuery1(String context) throws Exception;

    @Insert("insert into t_demo_position (position_name, position_describe, oper_time) " +
            "values (#{positionName}, #{positionDescribe}, #{operTime})")
    public void positionAdd(TDemoPosition position) throws Exception;

    @Update("update t_demo_position set position_name=#{positionName}, position_describe=#{positionDescribe}, oper_time=#{operTime} " +
            "where position_id=#{positionId}")
    public void positionUpd(TDemoPosition position) throws Exception;

    @DeleteProvider(type = PositionProvider.class, method = "getQueryDelSql")
    public void positionDel(@Param("positionIds") String... positionIds) throws Exception;
}
